home *** CD-ROM | disk | FTP | other *** search
Text File | 2005-04-15 | 7.0 KB | 326 lines | [TEXT/FB^e] |
-
- '~'
- /*
- ".MAIN" file for Program Generator
- Adapted for use with FB^3
- 02/18/99 - Chris Stasny
- */
- '~'
-
- RESOURCES "","APPLpG3!"
- 'WIDTH -2
-
- '~'
- '{PG3} <-- Do not remove.
- END GLOBALS
- '{PGÑ}
- /*
- Any code placed between these PGÑ markers will not be
- disturbed when you resave your project in Program Generator
- */
- '{PGÑ}
- EDIT = 2
- '{PG4}
- '~'
-
-
- '~Prototypes
- /*
- The following prototypes allow forward
- referenceing of functions in them .MAIN
- */
- def fn mainActions
- def fn menuActions
- def fn buttonActions
- def fn mouseActions
- def fn windowActions
- def fn fieldActions
- def fn otherActions
-
-
- '~Action Branch (gAction)
- SELECT gAction
- CASE _mainAction :fn mainActions
- CASE _menuAction :fn menuActions
- CASE _buttonAction :fn buttonActions
- CASE _mouseAction :fn mouseActions
- CASE _windowAction :fn windowActions
- CASE _fieldAction :fn fieldActions
- CASE _otherAction :fn otherActions
- END SELECT:RETURN
-
-
- '~Main Actions
-
- local fn mainActions
- '~'
-
- SELECT gSubAction
-
- CASE _mainStart
-
- /*
- Do any set up here for your program's
- initialization. At this point, all of PG's
- vars and functions have been initialized.
-
-
- You can open a window in PG with "FN pGbuild(_theWindow)"
- If you change the constant name of the first window,
- you must also change the constant in the following line.
-
- */
-
- gTopic$ = "1 Introduction"
- FN BuildHelpWindow
-
-
- CASE _mainOpen
-
- /*
- You need to open a file. The name of the
- file is gFileName$ (temp variable). The volume
- reference number is stored in gFileVol (temp var).
- If you want to store this information, use
-
- gSaveName$ = gFileName$
- gSaveVol = gFileVol
- gIsStationery = Bool: Is this stationery?
- */
-
- CASE _mainSave
- CASE _mainPrint
- CASE _mainTimer
- CASE _mainShutDown
- CASE _mainGoodBye
- END SELECT
- end fn
-
-
- '~Menu Actions
-
- local fn menuActions
- '~'
-
- /*
- gWhichMenu is the ID of the menu selected
- gWhichItem is the item number
- */
-
- SELECT gWhichMenu
- CASE _appleResMenu
-
- END SELECT
-
- end fn
-
-
- '~Button Actions
-
- local fn buttonActions
- '~'
- /*
- gWhichClass = The window
- gWhichButton = button reference number
- gButtonValue = current value (after toggle of
- checkboxes and radio buttons)
- gControlTitle$ = name of button
- */
-
- SELECT gWhichClass
- END SELECT
- end fn
-
-
- '~Mouse Actions
-
- local fn mouseActions
- '~'
- /*
- gWhichClass = The window
- gMouseY% = local y coordinate
- gMouseX% = local x coordinate
- gMouseLong& = synonym for gMouseY%,gMouseX%
- gWhereY% = global y coordinate
- gWhereX% = global x coordinate
- gClickStatus = 0: up
- 1: single-click (-1: and still down)
- 2: double-click (-2: and still down)
- 3: triple-click (-3: and still down)
- gModifiers = which modifier keys where pressed
- gWhen& = the tickcount when this click occurred
- */
-
- SELECT gWhichClass
-
- END SELECT
- end fn
-
-
- '~Window Actions
-
- local fn windowActions
- '~'
- /*
- gWhichClass = The type of window
- gWhichWindow = the actual window reference number
- gActWindow% = the active (frontmost) window
- gActiveDoc = synonym for gActWindow%
- gOutWindow% = window where drawing will occur
- gActPalette% = frontmost floating palette
- gWindowTitle$ = window title
-
- gWndTypeList&(gWhichWindow)
- = 4 character type set up in PG's Window
- attributes dialog (_TEXT",_PICT",_"NVIS")
- gWndDataHndl&(gWhichWindow) - Normally used by filters
- = long integer for storing window info
-
- gWndDirty(gWhichWindow) - For your use
- = Bool: Is window dirty?
- gWndInfo&(gWhichWindow) - For your use
- = long integer for storing window info
- */
-
- SELECT gSubAction
- CASE _windowClose
- CASE _windowUpdate
- CASE _windowActivate
- CASE _windowDeactivate
- CASE _windowSized
- CASE _windowMoved
- CASE _windowClicked
- CASE _windowWillZoomOut
- CASE _windowWillZoomIn
- CASE _windowWillGrow
- CASE _windowDocWillMove
- END SELECT
- end fn
-
-
- '~Field Actions
-
- local fn fieldActions
- '~'
- /*
- gWhichClass = The window
- gWhichField% = field reference number
- gFieldWas = last field ref number was╔
- */
-
- SELECT gSubAction
- CASE _fieldActivate
- CASE _fieldChanging
- CASE _fieldKeyPressed
- CASE _fieldReturn
- CASE _fieldTab
- CASE _fieldShiftTab
- CASE _fieldClear
- CASE _fieldLeft
- CASE _fieldRight
- CASE _fieldUp
- CASE _fieldDown
- CASE _fieldClicked
- END SELECT
- end fn
-
-
- '~Other Actions
-
- local fn otherActions
- '~'
- SELECT gSubAction
- CASE _otherDisk
- gAction = 0
- /*
- A disk was inserted.
- If "gAction=0" is removed, PG shows standard files dialog.
- */
-
- CASE _otherSwitch'background switch
- /*
- gInBackground = boolean
- gDialogValue = _MFResume returned to foreground
- _MFSuspend sent to background
- _MFClipboard same as _MFResume, but clipboard
- has been modified
- _MFMouse if event record contains mouse region,
- this is a mouse out of region message
- */
-
- CASE _otherScrap
- /*
- response to _MFClipboard above
- */
-
- CASE _otherCursor
- /*
- gWhichClass = cursor over this window type
- gWhichWindow = cursor over this window
- gActWindow% = the active (frontmost) window
- gActiveDoc = synonym for gActWindow%
- gOutWindow% = window where drawing will occur
- gActPalette% = frontmost floating palette
- gMouseY% = local y coordinate
- gMouseX% = local x coordinate
- gMouseLong& = synonym for gMouseY%,gMouseX%
- gWhereY% = global y coordinate
- gWhereX% = global x coordinate
- gWhichButton or gWhichField
- if negative = cursor over this field
- if positive = cursor over this button
- if zero = not over any button or field
-
- */
-
- CASE _otherKeyPressed
- /*
- A key was pressed, but no edit field is active.
- gKey$ = the key
- */
-
- CASE _otherBeforeMenu
- /*
- A command key sequence was pressed or the user clicked
- in the menu bar. Enable/disable menus here.
- */
-
- CASE _otherNullEvent
- /*
- The system is idle.
- gEventPtr& = pointer to event record
- gWhat% = always zero for nulls
- gMessage& = see Inside Macintosh
- gWhen& = current tickcount
- gWhereY% = global y coordinate
- gWhereX% = global x coordinate
- gModifiers = modifier keys
- */
-
- CASE _otherFilterEvent
- /*
- This is the same as _otherNullEvent above except that
- gWhat equals the event. This message is sent before FB
- processes anything. You can erase the event with: % EVENT,0.
- */
-
- CASE _otherUser
- /*
- A message was sent via DIALOG% = yourMessage%
- DIALOG& = yourData&
- */
-
-
-
- /*
- These actions relate to custom user items
- */
- CASE _otherUserInit'init the item
- CASE _otherUserUpdate'draw the item
- CASE _otherUserClick'mouse was clicked in the item
- CASE _otherUserDispose'dispose of the item
- END SELECT
- end fn
-
-
-